﻿<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:p="http://markupprogramming.codeplex.com/markup/programming"
    Height="300" Width="300">
    <Grid>
        <StackPanel>
            <TextBox x:Name="textBox1" Width="200" Height="20"/>
        </StackPanel>
        <Popup Name="popup" PlacementTarget="{Binding ElementName=textBox1}"
               IsOpen="{Binding IsKeyboardFocused, ElementName=textBox1, Mode=OneWay}">
            <StackPanel Orientation="Horizontal">
                <TextBlock Background="White" Text="Sample Popup content."/>
                <Thumb Name="thumb" Width="20" Height="20"/>
            </StackPanel>
            <p:Attached.Operations>
                <p:ScriptHandler Path="@FindElement('thumb').DragDelta">
                    @AssociatedObject.HorizontalOffset += @EventArgs.HorizontalChange;
                    @AssociatedObject.VerticalOffset += @EventArgs.VerticalChange;
                </p:ScriptHandler>
            </p:Attached.Operations>
        </Popup>
    </Grid>
</Window>
